<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>.: cPanel - <%=LG::NEWS%> :.</title>
	<?php $this->import()?>
	<script type="text/javascript">
		$(function() {
			$("#name").focus();
		});
		
		function confirmDelete(name) {
			var msg = "<%=$MSG_CONFIRM%>";
			return confirm(msg.replace("<%=LG::VAL%>",name));
		}
	</script>
</head>
<body>
	<?php $this->header()?><br/>
		<table width="100%"><tr>
			<td align="left" width="50%"><a href="?c=news&a=ccrid"><%=LG::NEWS%></a> ></td>
			<td align="right" width="50%"><a href="?c=news&a=ccreate"><%=LG::G_NEW%></a></td>
		</tr></table>
		<hr/>
		<center><form action="" method="post">
			<table class="grid" cellspacing="1" cellpadding="5">
				<tr>
					<th align="center"><%=LG::G_ORDER%></th>
					<th align="center" width="420"><%=LG::G_CATEGORY%></th>
					<th align="center"><%=LG::G_EDIT%></th>
					<th align="center"><%=LG::G_DEL%></th>
					<th align="center"><%=LG::G_ACTIVE%></th>
				</tr>
				<?php $i = 1 + DAO::PAGE_SMALL * ($page - 1); foreach ($cats->list as $cat) { ?>
					<tr>
						<td align="center"><%=$i%></td>
						<td align="left">
							<a href="?c=news&a=ngrid&cid=<%=$cat->id%>"><%=$cat->name%></a>
						</td>
						<td align="center"><a href="?c=news&a=cedit&id=<%=$cat->id%>"><%=LG::G_EDIT%></a></td>
						<td align="center"><a href="?c=news&a=cdel&id=<%=$cat->id%>" onclick="return confirmDelete('<%=$cat->name%>')">Delete</a></td>
						<td align="center"><%=Html::checkbox('ids[]', $cat->id, $cat->active > 0, '', 'active')%></td>
					</tr>
				<?php $i++; } ?>
				<?php if (sizeof($cats->list) == 0) { ?>
					<tr><td colspan="7" align="right"><%=str_replace(LG::ENTITY, LG::NEWSCAT, LG::MSG_EMPTY)%></td></tr>
				<?php } ?>
				<tr><td colspan="6" align="right" class="paging">
					<?php for ($i = 1; $i <= $cats->pages; $i++) {?>
						<?php if ($i == $page) {?> 
							<a class="chosen">[ <?php echo $i?> ]</a>
						<?php } else {?>  
							<a href="?c=cat&a=grid&page=<?php echo $i;?>">[ <?php echo $i?> ]</a>
						<?php } ?>
					<?php } ?>
				</td></tr>
			</table>
			<?php if (sizeof($cats) > 0) { ?>
				<hr/>
				<input type="submit" value="<%=LG::F_SAVE%>"/>
			<?php } ?>
		</form></center>
		<br/>
	<?php $this->footer()?>
</body>
</html>